<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let a = 'name';
    let obj = {}

    //obj.name = 'tom'

    obj[a] = 'tom'      // 使用方括号取出变量的值作为对象的key

    console.log(obj);



</script>
</body>
</html>